//
//  UIImage+Shrink.m
//  Patrol
//
//  Created by 范武 on 13-3-11.
//  Copyright (c) 2013年 FSTI. All rights reserved.
//

#import "UIImage+Shrink.h"

@implementation UIImage (Shrink)
- (UIImage *)shrinkToSize:(CGSize)size
{
    CGRect bound = CGRectMake(0, 0, size.width, size.height);
    
    UIGraphicsBeginImageContext(size);
    CGContextRef context = UIGraphicsGetCurrentContext();
    CGContextSetInterpolationQuality(context, kCGInterpolationHigh);
    CGContextSetAllowsAntialiasing(context, YES);
    [self drawInRect:bound];
    UIImage * imageCopy = UIGraphicsGetImageFromCurrentImageContext();
    
    UIGraphicsEndImageContext();
    
    return imageCopy;
}
@end
